import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_tutorial/app/modules/index/index_controller.dart';
import 'package:getx_tutorial/app/modules/login/login_page.dart';
import 'package:getx_tutorial/app/routes/app_pages.dart';

class IndexPage extends GetView<IndexController> {
  @override
  Widget build(BuildContext context) {
    final c = Get.put(IndexController());

    return Scaffold(
      appBar: null,

      body: Navigator(
        key: Get.nestedKey(1),
        initialRoute: Routes.ROUTE,
        onGenerateRoute: c.onGenerateRoute,
      ),
      bottomNavigationBar: Obx(() {
        return BottomNavigationBar(
          items: c.bottomNavItems,
          currentIndex: c.currentIndex.value,
          type: BottomNavigationBarType.fixed,
          onTap: c.changePage
        );
      }),
    );
  }
}